Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add baseUrl option #294

Merged
merged 10 commits into from
Apr 5, 2024
Merged

feat: add baseUrl option #294

merged 10 commits into from
Apr 5, 2024

Conversation

michalkvasnicak
Copy link
Collaborator

@michalkvasnicak michalkvasnicak commented Apr 5, 2024

Change Summary

This PR adds baseUrl option which allows us to override the url detected from request.

Merge Checklist

  • PR has a Changeset
  • PR includes documentation if necessary
  • PR updates the boilerplates if necessary

Copy link

vercel bot commented Apr 5, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
frames-js ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 5, 2024 2:11pm
framesjs-debugger ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 5, 2024 2:11pm

packages/frames.js/src/core/createFrames.ts Outdated Show resolved Hide resolved
packages/frames.js/src/core/types.ts Outdated Show resolved Hide resolved
Comment on lines 77 to 84
const context: FramesContext<TState> = {
baseUrl: url,
basePath,
initialState: initialState as TState,
request,
url: new URL(request.url),
resolvedBaseUrl: resolveBaseUrl(request, url, basePath),
};
Copy link
Contributor

@stephancill stephancill Apr 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it necessary to expose all of these (baseUrl, basePath, url, and resolvedBaseUrl) to the user? perhaps we should just give them the resolvedBaseUrl and call it baseUrl and remove the url shortcut to be more explicit when they want to access the request url?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

makes sense but that's breaking change.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

url was there because @davidfurlong found it better to access it like this. So I would not remove that. I will move resolvedBaseUrl to baseUrl.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i don't think basePath was very useful to the user to begin with so it's okay to remove in a breaking change. what do you think?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets do that in separate change

@stephancill stephancill merged commit c4643eb into dev Apr 5, 2024
7 checks passed
@stephancill stephancill deleted the feat/url-option branch April 5, 2024 14:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants